<html>
<head>
<meta NAME="author" CONTENT="Judit Vasko-Szedlar">
    <script type="text/javascript" src="../../../sh_main.js"></script>
    <script type="text/javascript" src="../../../sh_javascript.js"></script>
    <script type="text/javascript" src="../../../sh_html.js"></script>
    <link REL ="stylesheet" TYPE="text/css" HREF="../../../sh_nedit.css" TITLE="Style">
<link REL ="stylesheet" TYPE="text/css" HREF="../../../../marvinmanuals.css" TITLE="Style">
<link rel="stylesheet" href="../../../javacode.css" type="text/css">
<title>MarvinSketch Example - Student Examination</title>
</head>
<body onload="sh_highlightDocument();">
<h1>MarvinSketch Example - Student Examination</h1>

<p>
<table>
<tr>
<td align="center">
<script LANGUAGE="JavaScript1.1" SRC="../../../../marvin.js"></script>
<script LANGUAGE="JavaScript1.1">
    function exportMol(format) {
            if(document.MSketch != null) {
                    var s = document.MSketch.getMol(format);
                    // Convert "\n" to local line separator
                    s = unix2local(s);
                    document.MolForm.MolTxt.value = s;
            } else {
                    alert("Cannot import molecule:\n"+
                          "no JavaScript to Java communication"+
                          "in your browser.\n");
            }
    }
<!--
msketch_name = "MSketch";
msketch_begin("../../../..", 490, 420);
msketch_param("menuconfig", "/examples/applets/sketch/studentexam/menuconfig.xml");
msketch_param("lonePairsAutoCalc", "false");
msketch_param("lonePairsVisible", "true");
msketch_param("sketchCarbonVisibility", "on");
msketch_param("implicitH", "off");
msketch_param("valenceErrorVisible", "false");    
msketch_param("shortcuts", "/examples/applets/sketch/studentexam/shortcuts.xml");
msketch_param("ttmpls0", "*Generic*/examples/applets/sketch/studentexam/generic.csmol");
msketch_param("ttmpls1", "*Rings*chemaxon/marvin/templates/rings.t");
msketch_param("templateToolbarCustomizable", "false");    
msketch_end();
//-->
</script>
</td>
<td rowspan="3" valign="top">
<p>This example shows how MarvinSketch can be used in <b>online examinations</b> in different subjects.</p>
<p>This examination example tests the knowledge of students related to <b>lone pairs and radical electrons</b>.</p>
<p><em>Task: Use the two lowermost multifunctional buttons of the toolbar on the left to explicitely define the lone pairs and radical electrons on atoms.<br>
After drawing the molecule, use the 'Submit Answer' button below the MarvinSketch window to generate its ChemAxon Extended SMILES format.</em></p>
<p>Note that the MarvinSketch applet was configured to better suit the task,
    for example the Lewis-structure representation is always visible.<br> 
    For more details please see the Technical background part below.<p>
</td>
</tr>
<form NAME=MolForm onSubmit="return false">
<tr>
<td align="center">
    <input TYPE=BUTTON VALUE="Submit Answer"
           onClick="exportMol('cxsmiles:u')">
</td>
</tr>
<tr>
<td align="center">
    <textarea NAME="MolTxt" ROWS=10 COLS=60></textarea>
</td>
</tr>
</form>
</table>
<h4>Technical background</h4>
<p>In this example the MarvinSketch applet is customized with the help of parameters. The following changes were made:</p>
<ul>
<li>The main menubar is disabled.</li>
<li>The contextual menu of atoms is disabled.</li>
<li>The toolbar on the left hand side contains 2 multifunctional buttons for setting lone-pair electrons and radical electrons.</li>
<li>The bottom template toolbar contains only the "Rings" and a custom "Generic" template groups. The function to modify the visible template groups on-the-fly is disabled.</li>
<li>The Ctrl-O shortcut is disabled to prevent opening structure files.</li>
<li>The visibility of implicit hydrogen atoms is switched off.</li>
<li>The automatic calculation of lone-pair electrons is switched off, and the number of lone pairs is set to 0 at each atom as default.</li>
<li>The automatic calculation and display of valence errors is switched off.</li>
<li>The C label is always visible on Carbon atoms.</li>    
</ul>
<p>
The code of the customized applet is as follows:    
</p>
<blockquote>
<pre class="sh_html">
&lt;script LANGUAGE="JavaScript1.1" SRC="../../../../marvin.js"&gt;&lt;/script&gt;
&lt;script LANGUAGE="JavaScript1.1"&gt;
</pre><pre class="sh_javascript">&lt;!--
msketch_name = "MSketch";
msketch_begin("../../../..", 490, 420);
msketch_param("menuconfig", "/examples/applets/sketch/studentexam/menuconfig.xml");
msketch_param("lonePairsAutoCalc", "false");
msketch_param("lonePairsVisible", "true");
msketch_param("sketchCarbonVisibility", "on");
msketch_param("implicitH", "off");
msketch_param("valenceErrorVisible", "false");
msketch_param("shortcuts", "/examples/applets/sketch/studentexam/shortcuts.xml");
msketch_param("ttmpls0", "*Generic*/examples/applets/sketch/studentexam/generic.csmol");
msketch_param("ttmpls1", "*Rings*chemaxon/marvin/templates/rings.t");
msketch_param("templateToolbarCustomizable", "false");
msketch_end();
</pre><pre class="sh_html">//--&gt;
&lt;/script&gt;
</pre>
</blockquote>

<p>
The menu configuration file: <a href="menuconfig.xml">menuconfig.xml</a><br>
The shortcut configuration file: <a href="shortcuts.xml">shortcuts.xml</a><br>
Custom "Generic" template group file: <a href="generic.csmol">generic.csmol</a>
</p>

<p>The 'Submit Answer' button generates the ChemAxon Extended Smiles. The <code><b>u</b></code> option
was used to generate unique smiles.

<pre class="sh_html">
    &lt;script LANGUAGE="JavaScript1.1" SRC="../../../../marvin.js"&gt;&lt;/script&gt;
    &lt;script LANGUAGE="JavaScript1.1"&gt;</pre><pre class="sh_javascript">
        function exportMol(format) {
                if(document.MSketch != null) {
                        var s = document.MSketch.getMol(format);
                        // Convert "\n" to local line separator
                        s = unix2local(s);
                        document.MolForm.MolTxt.value = s;
                } else {
                        alert("Cannot import molecule:\n"+
                              "no JavaScript to Java communication"+
                              "in your browser.\n");
                }
        }</pre><pre class="sh_html">    &lt;/script&gt;
    
    ... // creating HTML form
        &lt;input TYPE=BUTTON VALUE="Submit Answer"
                  onClick="exportMol('cxsmiles:u')"&gt;
    ... // creating HTML form
</pre>


<p>
<center><div class="lenia">&nbsp;</div></center>
<p>
</body>
</html>
